package com.example.demo.mapper;

import com.example.demo.demoEntity.TPermissionEntity;
import com.example.demo.demoEntity.TUserEntity;
import com.example.demo.demoEntity.TUserRoleEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

//@NoRepositoryBean
//
//@Repository
public interface TUserEntityMapper extends JpaRepository<TUserEntity,Integer>, Serializable {
    List<TUserEntity> findByUserNameContaining( String userName);
    @Query( "select  u from TUserEntity u where u.userName = :#{#tuserEntity.userName} and u.password = :#{#tuserEntity.password}")
    List<TUserEntity> queryParamByTUserEntityUserName(@Param("tuserEntity") TUserEntity tuserEntity);

    List<TUserEntity> findByUserNameNot(String username);
    @Query("select new com.example.demo.demoEntity.TUserRoleEntity(b.id,b.userId,b.roleId) FROM TUserEntity a inner join TUserRoleEntity b on a.id=b.userId")
    List<TUserRoleEntity>  queryByQuanxian();
}
